console.log("----------promise run-----------")

var promise = new Promise(function(resolve, reject) {
    //传入function的函数会立刻执行
    var value=9;
    console.log("run right away");//1
    if (value){
      resolve(value);
    } else {
      reject(error);
    }
    console.log("finish new promise");//2
  });
  console.log("after new promise");//3
  promise.then(function(value){
      console.log("get value="+value);//5
  })
  console.log("after then");//4